<template>
  <div>
    <div class="two address">
      <div class="customer">
        <span class="title">客户内网分流DNS地址</span>
        <el-button type="primary" size="mini" @click="addDNS">添加一行</el-button>
      </div>
      <el-form>
        <el-table
          :header-cell-style="{'text-align':'center'}"
          :cell-style="{'text-align':'center'}"
          :data="intranetDistriDNS"
          border
          stripe
        >
          <el-table-column type="index" label="序号" width="80" />
          <el-table-column prop="INTRANET_DISTRI_IPV4" label="IPV4" width="240">
            <template slot-scope="scope">
              <el-input v-model="scope.row.INTRANET_DISTRI_IPV4" size="mini" placeholder="请输入内容"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="INTRANET_DISTRI_IPV6" label="IPV6" width="240">
            <template slot-scope="scope">
              <el-input v-model="scope.row.INTRANET_DISTRI_IPV6" size="mini" placeholder="请输入内容"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="80">
            <template #default="scope">
              <div>
                <!-- <span>{{ row }}</span> -->
                <el-button size="mini" type="danger" @click="delDNS(scope.$index)">删除</el-button>
              </div>
            </template>
          </el-table-column>

        </el-table>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      intranetDistriDNS: [
        { INTRANET_DISTRI_IPV4: '', INTRANET_DISTRI_IPV6: '' },
        { INTRANET_DISTRI_IPV4: '', INTRANET_DISTRI_IPV6: '' },
        { INTRANET_DISTRI_IPV4: '', INTRANET_DISTRI_IPV6: '' }
      ]
    }
  },
  methods: {
    addDNS() {
      this.intranetDistriDNS.push({ INTRANET_DISTRI_IPV4: '', INTRANET_DISTRI_IPV6: '' })
    },
    async delDNS(index) {
      try {
        await this.$confirm('确定要删除吗？')
        this.intranetDistriDNS.splice(index, 1)
        // this.intranetDistriDNS = this.intranetDistriDNS.filter(i => i !== row)
      } catch (error) {
        console.log(error)
      }
    },
    add () {
      console.log(123)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
